Table of Contents
Low Level Content API Basics

Overview

EO.Pdf also provides a set of low level content objects that allow you to directly place formatted output contents on the page. These low level content objects have a much more direct correspondence with actual objects in a PDF file and can be used to generate output on the page regardless of the content flow.

Relationship with AcmContent

An AcmContent object is rendered into these low level content objects first. These low level content objects are then rendered as a PDF file.

Note: Even low level content objects are more directly associated to the actual PDF file contents, you should use AcmContent whenever possible. AcmContent is an additional layer on top of these low level content objects and is much easier to use and also much more powerful.

Low Level Content Types

The following table lists all low level content types:

Content Type Remarks
PdfContent This is the base class for all content types. It can also be used as a container for other content objects.
PdfTextLayer Starts a new text layer on a page. A PdfTextContent must be placed inside a PdfTextLayer. See Using PdfTextContent for more details.
PdfTextContent Output text on the page. Must be placed inside a PdfTextLayer object.
PdfImageContent Place an image on the page.
PdfPathContent Construct a path on the page, then optionally fill or stroke it (to create lines and shapes).

Coordinate System

Low level content API uses PDF "user space" coordinate system, which is a PDF file's internal coordinate system. The key differences between PDF "user space" coordinate system and AcmContent coordinate system are:

  • The origin for AcmContent coordinate system is the top left corner of the page. The origin for PDF "user space" coordinate system is bottom left of the page;
  • The Y axis for AcmContent coordinate system extends from the top of the page downwards. The Y axis for PDF "user space" coordinate system extends from bottom upwards;
  • The unit for AcmContent is always inch. The unit for PDF "user space" is 1/72 inch by default and can be altered with transformation matrix;

Transformation Matrix

Each low level content object exposes a GfxMatrix property, which can be used to transform (move), scale or rotate the output of that content. Conceptually, you can think that each low level content objects has its own coordinate system and GfxMatrix is used to map that coordinate system into a PDF page's coordinate system ("user space" coordinate system).

For example, in order to place a PdfImageContent at a specific position (say x = 300, y = 200) on the page, you must set the PdfImageContent's GfxMatrix to "move" the origin of PdfImageContent own coordinate system to (300, 200) in the "user space" coordinate system. When PdfImageContent draws the image, it's just drawing in its own coordinate system and it always starts from (0, 0). However because (0, 0) in its own coordinate system corresponds to (300, 200) in the final "user space" coordinate system, the image will appear at (300, 200) on the final output.

A transformation matrix can perform much more complicated transform than just "translate" (move). Details about transformation matrix are beyond the scope of this document. A much more in depth article about transformation matrix can be found here on MSDN's Web site (If the link is no longer valid, search for "Matrix Representation of Transformations" online).